10. CodeBuild
CodeBuild
CodeBuild: An AWS Continuous Integration service
Continuous Integration: The first part of Continuous Delivery
FSND C4 L2 A11 CodeBuild
Codebuild recap
CodeBuild Recap
- Continuous Integration: frequent check-ins to a central repository which trigger automated builds and tests
- CodeBuild: A fully managed continuous integration system offered by AWS
- Codebuild can be added as an action to a CodePipeline stage
CodeBuild
SOLUTION:
Catch bugs earlier in the development processCodeBuild
SOLUTION:
- Compile code
- Run tests
- Create deployable packages
More resources
Build Spec File
The instructions that a CodeBuild stage will follow are put in a build spec file named
buildspec.yml
. This file contains all of the commands that the build will run and any related settings. This file should be placed at the root of your project directory. Amazon supplies
CodeBuild samples
, you can see examples of build spec files there. The sample for a simple Docker custom image has the build spec:
version: 0.2
phases:
install:
commands:
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2&
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
pre_build:
commands:
- docker build -t helloworld .
build:
commands:
- docker images
- docker run helloworld echo "Hello, World!"
You can see that it is divided into the phases ‘install’, ‘pre_build’, and ‘build’. Each phase contains commands, which are the same commands you would use to run Docker locally. You can read about the build spec syntax here